package com.insigma.business.qrcode.placement.controller;

import com.insigma.business.qrcode.common.vo.BaseResponse;
import com.insigma.business.qrcode.placement.dto.*;
import com.insigma.business.qrcode.placement.dto.excel.ExportDistrDetlRequestDTO;
import com.insigma.business.qrcode.placement.dto.request.*;
import com.insigma.business.qrcode.placement.service.CodeOnPlacementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author max
 * @Description:
 * @date 2024-04-16 14:10
 */
@Api("码上安置")
@RestController
@RequestMapping("/web/codeOnPlacement")
public class CodeOnPlacementController {

    @Resource
    private CodeOnPlacementService codeOnPlacementService;

    @ApiOperation("新增安置公示")
    @PostMapping("/addPlacementPubInfo")
    public BaseResponse<String> addPlacementPubInfo(@RequestBody PlacementPubInfoAddUpdRequestDTO requestDTO) {
        return codeOnPlacementService.addPlacementPubInfo(requestDTO);
    }

    @ApiOperation("修改安置公示")
    @PostMapping("/updatePlacementPubInfo")
    public BaseResponse<String> updatePlacementPubInfo(@RequestBody PlacementPubInfoAddUpdRequestDTO requestDTO) {
        return codeOnPlacementService.updatePlacementPubInfo(requestDTO);
    }

    @ApiOperation("删除安置公示")
    @PostMapping("/delPlacementPubInfo")
    public BaseResponse<String> delPlacementPubInfo(@RequestBody PlacementPubInfoAddUpdRequestDTO requestDTO) {
        return codeOnPlacementService.delPlacementPubInfo(requestDTO);
    }

    @ApiOperation("查询安置公示列表")
    @PostMapping("/queryPlacementPubInfoList")
    public BaseResponse<List<PlacementPubInfoDTO>> queryPlacementPubInfoList(@RequestBody PlacementPubInfoQueryRequestDTO requestDTO) {
        return codeOnPlacementService.queryPlacementPubInfoList(requestDTO);
    }

    @ApiOperation("查询安置公示详情")
    @PostMapping("/queryPlacementPubInfo")
    public BaseResponse<PlacementPubInfoDTO> queryPlacementPubInfo(@RequestBody PlacementPubInfoQueryRequestDTO requestDTO) {
        return codeOnPlacementService.queryPlacementPubInfo(requestDTO);
    }

    //待安置生活补助
    @ApiOperation("下载导入模板")
    @PostMapping("/downloadResetTemplate")
    public void downloadResetTemplate(HttpServletResponse response) throws Exception {
        codeOnPlacementService.downloadResetTemplate(response);
    }

    @ApiOperation("导入待安置生活补助信息")
    @PostMapping("/importResetSubsidyDistr")
    public BaseResponse<ImportResDTO> importResetSubsidyDistr(MultipartFile file) throws Exception {
        return codeOnPlacementService.importResetSubsidyDistr(file);
    }

    @ApiOperation("查询待安置生活补助信息列表")
    @PostMapping("/queryResetSubsidyDistrDetlList")
    public BaseResponse<List<ResetSubsidyDistrDetlDTO>> queryResetSubsidyDistrDetlList(@RequestBody ResetSubsidyDistrDetlQueryRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.queryResetSubsidyDistrDetlList(requestDTO);
    }

    @ApiOperation("查询待安置生活补助信息明细")
    @PostMapping("/queryResetSubsidyDistrDetl")
    public BaseResponse<ResetSubsidyDistrDetlDTO> queryResetSubsidyDistrDetl(@RequestBody ResetSubsidyDistrDetlQueryRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.queryResetSubsidyDistrDetl(requestDTO);
    }

    @ApiOperation("修改待安置生活补助信息")
    @PostMapping("/updateResetSubsidyDistrDetl")
    public BaseResponse<String> updateResetSubsidyDistrDetl(@RequestBody ResetSubsidyDistrDetlUpdRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.updateResetSubsidyDistrDetl(requestDTO);
    }

    @ApiOperation("删除待安置生活补助信息")
    @PostMapping("/delResetSubsidyDistrDetl")
    public BaseResponse<String> delResetSubsidyDistrDetl(@RequestBody ResetSubsidyDistrDetlUpdRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.delResetSubsidyDistrDetl(requestDTO);
    }

    @ApiOperation("确认待安置生活补助信息")
    @PostMapping("/confirmResetSubsidyDistrDetl")
    public BaseResponse<String> confirmResetSubsidyDistrDetl(@RequestBody ResetSubsidyDistrDetlUpdRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.confirmResetSubsidyDistrDetl(requestDTO);
    }

    //灵活就业/自主就业一次性补助
    @ApiOperation("下载灵活就业/自主就业一次性补助导入模板")
    @PostMapping("/downloadFlexSelfTemplate")
    public void downloadFlexSelfTemplate(HttpServletResponse response) throws Exception {
        codeOnPlacementService.downloadFlexSelfTemplate(response);
    }

    @ApiOperation("导入灵活就业/自主就业一次性补助信息")
    @PostMapping("/importFlexSelfSubsidyDistr")
    public BaseResponse<ImportResDTO> importFlexSelfSubsidyDistr(MultipartFile file, String subsidyType) throws Exception {
        return codeOnPlacementService.importFlexSelfSubsidyDistr(file, subsidyType);
    }

    @ApiOperation("查询灵活就业/自主就业一次性补助列表")
    @PostMapping("/queryFlexSelfSubsidyDistrDetlList")
    public BaseResponse<List<FlexSelfSubsidyDistrDetlDTO>> queryFlexSelfSubsidyDistrDetlList(@RequestBody FlexSelfSubsidyDistrDetlQueryRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.queryFlexSelfSubsidyDistrDetlList(requestDTO);
    }

    @ApiOperation("查询灵活就业/自主就业一次性补助明细")
    @PostMapping("/queryFlexSelfSubsidyDistrDetl")
    public BaseResponse<FlexSelfSubsidyDistrDetlDTO> queryFlexSelfSubsidyDistrDetl(@RequestBody FlexSelfSubsidyDistrDetlQueryRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.queryFlexSelfSubsidyDistrDetl(requestDTO);
    }

    @ApiOperation("修改灵活就业/自主就业一次性补助信息")
    @PostMapping("/updateFlexSelfSubsidyDistrDetl")
    public BaseResponse<String> updateFlexSelfSubsidyDistrDetl(@RequestBody FlexSelfSubsidyDistrDetlUpdRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.updateFlexSelfSubsidyDistrDetl(requestDTO);
    }

    @ApiOperation("删除灵活就业/自主就业一次性补助信息")
    @PostMapping("/delFlexSelfSubsidyDistrDetl")
    public BaseResponse<String> delFlexSelfSubsidyDistrDetl(@RequestBody FlexSelfSubsidyDistrDetlUpdRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.delFlexSelfSubsidyDistrDetl(requestDTO);
    }

    @ApiOperation("确认灵活就业/自主就业一次性补助信息")
    @PostMapping("/confirmFlexSelfSubsidyDistrDetl")
    public BaseResponse<String> confirmFlexSelfSubsidyDistrDetl(@RequestBody FlexSelfSubsidyDistrDetlUpdRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.confirmFlexSelfSubsidyDistrDetl(requestDTO);
    }

    @ApiOperation("导出补助明细列表")
    @PostMapping("/exportDistrDetlList")
    public void exportDistrDetlList(@RequestBody ExportDistrDetlRequestDTO requestDTO, HttpServletResponse response) throws Exception {
        codeOnPlacementService.exportDistrDetlList(requestDTO, response);
    }

    @ApiOperation("小程序端-资金发放确认-个人银行信息查询")
    @PostMapping("/queryPsnBankInfo")
    public BaseResponse<PsnBankInfoDTO> queryPsnBankInfo(@RequestBody ResetSubsidyDistrDetlQueryRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.queryPsnBankInfo(requestDTO);
    }

    @ApiOperation("小程序端-资金发放确认-待安置信息查询")
    @PostMapping("/queryResetSubsidyDistrApplet")
    public BaseResponse<ResetSubsidyDistrAppletDTO> queryResetSubsidyDistrApplet(@RequestBody ResetSubsidyDistrDetlQueryRequestDTO requestDTO) throws Exception {
        return codeOnPlacementService.queryResetSubsidyDistrApplet(requestDTO);
    }

}
